#ifndef INPUTTYPES_H
#define INPUTTYPES_H

#include <Qt>
#include <QString>
#include <QMap>
#include <QVector>
#include <QMetaType>

struct ButtonType
{
  enum Type
  {
    TYPE_UNKNOWN,
    TYPE_KEYBOARD,
    TYPE_GAMEPAD
  };

  ButtonType();
  ButtonType(Type t, int button, unsigned int gamepadNumber=0);

  QString toString() const;
  bool operator==(const ButtonType& bt) const;

  Type mType;
  Qt::Key mKeyboard;
  unsigned int mGamepad;
  unsigned int mGamepadNumber;
};

struct HalfAxisType
{
  enum Type
  {
    TYPE_UNKNOWN,
    TYPE_BUTTON,
    TYPE_AXIS
  };

  enum Direction
  {
    DIRECTION_NONE = ' ',
    DIRECTION_POS = '+',
    DIRECTION_NEG = '-'
  };

  HalfAxisType();

  QString toString() const;
  bool operator==(const HalfAxisType& hat) const;
  bool operator!=(const HalfAxisType& hat) const;

  Type mType;
  ButtonType mButton;
  unsigned int mGamepadAxis;
  Direction mDirection;
  unsigned int mGamepadNumber;
};

struct AxisType
{
  QString toString() const;

  HalfAxisType mPos;
  HalfAxisType mNeg;
};

typedef QVector<ButtonType> ButtonVector;
typedef QMap<QString, ButtonType> ButtonMap;

typedef QVector<AxisType> AxisVector;
typedef QMap<QString, AxisType> AxisMap;

Q_DECLARE_METATYPE(ButtonType)
Q_DECLARE_METATYPE(HalfAxisType)
Q_DECLARE_METATYPE(AxisType)

#endif
